<?php
 /* 	These code was generated using phpCIGen v 0.1.a (21/04/2009)
	#zaqi 		zaqi.smart@gmail.com,http://zenzaqi.blogspot.com, 
    #songbee	mukhlisona@gmail.com
	#CV. Trust Solution, jl. Saronojiwo 19 Surabaya, http://www.ts.co.id
	
	+ Module  		: s_info Model
	+ Description	: For record model process back-end
	+ Filename 		: c_s_info.php
 	+ Author  		: 
 	+ Created on 27/Jan/2010 11:25:10
	
*/

class M_s_info extends CI_Model{
		
		//constructor
		function M_s_info() {
			parent::__construct();
		}
		
		//function for get list record
		function s_info_list($filter,$start,$end){
			$query = "SELECT * FROM tbl_s_info LIMIT 1";
			
			$result = $this->db->query($query);
			
			
			if($nbrows>0){
				foreach($result->result() as $row){
					$arr[] = $row;
				}
				$jsonresult = json_encode($arr);
				return '({"total":"'.$nbrows.'","results":'.$jsonresult.'})';
			} else {
				return '({"total":"0", "results":""})';
			}
		}
		
		//function for create new record
		function s_info_create($info_nama ,$info_alamat ,$info_notelp ,$info_nofax ,$info_email ,
								$info_website ,$info_slogan ,$info_logo, $info_icons, $info_background, 
								$info_theme ){
			$data = array(
				"info_nama"=>$info_nama, 
				"info_alamat"=>$info_alamat, 
				"info_notelp"=>$info_notelp, 
				"info_nofax"=>$info_nofax, 
				"info_email"=>$info_email, 
				"info_website"=>$info_website, 
				"info_slogan"=>$info_slogan, 
				"info_logo"=>$info_logo,
				"info_icon"=>$info_icons,
				"info_background"=>$info_background, 
				"info_theme"=>$info_theme 
			);
			$this->db->insert('s_info', $data); 
			if($this->db->affected_rows())
				return '1';
			else
				return '0';
		}
		
		//function for update record
		function s_info_update($info_id,$info_nama,$info_alamat,$info_notelp,$info_nofax,$info_email,
									$info_website,$info_slogan,$info_logo,$info_icon,$info_background,$info_theme){
			$data = array(
				"info_nama"=>$info_nama, 
				"info_alamat"=>$info_alamat, 
				"info_notelp"=>$info_notelp, 
				"info_nofax"=>$info_nofax, 
				"info_email"=>$info_email, 
				"info_website"=>$info_website, 
				"info_slogan"=>$info_slogan, 
				"info_logo"=>$info_logo, 
				"info_icon"=>$info_icon, 
				"info_background"=>$info_background,
				"info_theme"=>$info_theme 
			);
			
			$this->db->where('info_id', $info_id);
			$this->db->update('s_info', $data);
			$sql="UPDATE s_info set  where info_id='".$info_id."'";
			$this->db->query($sql);
			return '1';
		}
		
}
?>